#include <QtGui>
#include <QtCore/QTextCodec>
#include <QTranslator>
#include "gv_zonesconfigurationdetailinputdialog.h"
#include "gv_zonesconfigurationdetaildialog.h"
#include "gv_home.h"
#include "gv_setting.h"

extern GV_Setting *gvsetting;
extern QDialog  *dialog;
GV_ZonesConfigurationDetailInputDialog::GV_ZonesConfigurationDetailInputDialog(QWidget *parent)
       : QDialog(parent)
{
    setupUi(this);

    QTranslator translator;
    translator.load(gvsetting->GV_GetLanguage(),".");
    qApp->installTranslator(&translator);
    reloadtext();

    connect(BackButton,SIGNAL(clicked()),this,SLOT(home()));
    connect(CancelButton,SIGNAL(clicked()),this,SLOT(home()));
    connect(SaveButton,SIGNAL(clicked()),this,SLOT(save()));

    connect(APanelButton,SIGNAL(clicked()),this,SLOT(keyA()));
    connect(BPanelButton,SIGNAL(clicked()),this,SLOT(keyB()));
    connect(CPanelButton,SIGNAL(clicked()),this,SLOT(keyC()));
    connect(DPanelButton,SIGNAL(clicked()),this,SLOT(keyD()));
    connect(EPanelButton,SIGNAL(clicked()),this,SLOT(keyE()));
    connect(FPanelButton,SIGNAL(clicked()),this,SLOT(keyF()));
    connect(GPanelButton,SIGNAL(clicked()),this,SLOT(keyG()));
    connect(HPanelButton,SIGNAL(clicked()),this,SLOT(keyH()));
    connect(IPanelButton,SIGNAL(clicked()),this,SLOT(keyI()));
    connect(JPanelButton,SIGNAL(clicked()),this,SLOT(keyJ()));
    connect(KPanelButton,SIGNAL(clicked()),this,SLOT(keyK()));
    connect(LPanelButton,SIGNAL(clicked()),this,SLOT(keyL()));
    connect(MPanelButton,SIGNAL(clicked()),this,SLOT(keyM()));
    connect(NPanelButton,SIGNAL(clicked()),this,SLOT(keyN()));
    connect(OPanelButton,SIGNAL(clicked()),this,SLOT(keyO()));
    connect(PPanelButton,SIGNAL(clicked()),this,SLOT(keyP()));
    connect(QPanelButton,SIGNAL(clicked()),this,SLOT(keyQ()));
    connect(RPanelButton,SIGNAL(clicked()),this,SLOT(keyR()));
    connect(SPanelButton,SIGNAL(clicked()),this,SLOT(keyS()));
    connect(TPanelButton,SIGNAL(clicked()),this,SLOT(keyT()));
    connect(UPanelButton,SIGNAL(clicked()),this,SLOT(keyU()));
    connect(VPanelButton,SIGNAL(clicked()),this,SLOT(keyV()));
    connect(WPanelButton,SIGNAL(clicked()),this,SLOT(keyW()));
    connect(XPanelButton,SIGNAL(clicked()),this,SLOT(keyX()));
    connect(YPanelButton,SIGNAL(clicked()),this,SLOT(keyY()));
    connect(ZPanelButton,SIGNAL(clicked()),this,SLOT(keyZ()));

    connect(CapPanelButton,SIGNAL(clicked()),this,SLOT(keyCap()));
    connect(ShiftPanelButton,SIGNAL(clicked()),this,SLOT(keyShift()));
    connect(num1PanelButton,SIGNAL(clicked()),this,SLOT(keynum1()));
    connect(num2PanelButton,SIGNAL(clicked()),this,SLOT(keynum2()));
    connect(num3PanelButton,SIGNAL(clicked()),this,SLOT(keynum3()));
    connect(dotPanelButton,SIGNAL(clicked()),this,SLOT(keydot()));
    connect(commaPanelButton,SIGNAL(clicked()),this,SLOT(keycomma()));
    connect(_PanelButton,SIGNAL(clicked()),this,SLOT(key_()));
    connect(SpacePanelButton,SIGNAL(clicked()),this,SLOT(keySpace()));
    connect(BackspacePanelButton,SIGNAL(clicked()),this,SLOT(keyBackspace()));


}
void GV_ZonesConfigurationDetailInputDialog::reloadtext()
{
    NameHintsLabel->setText(tr("Zones"));

    BackButton->setText(tr("Back"));
    SaveButton->setText(tr("Save"));
    CancelButton->setText(tr("Cancel"));

    BackspacePanelButton->setText(tr("Backspace"));
    SpacePanelButton->setText(tr("Space"));
    ShiftPanelButton->setText(tr("Shift"));
    CapPanelButton->setText(tr("Cap"));
}
void GV_ZonesConfigurationDetailInputDialog::keyA()
{
    currentNum="A";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyB()
{
    currentNum="B";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyC()
{
    currentNum="C";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyD()
{
    currentNum="D";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyE()
{
    currentNum="E";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyF()
{
    currentNum="F";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyG()
{
    currentNum="G";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyH()
{
    currentNum="H";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyI()
{
    currentNum="I";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyJ()
{
    currentNum="J";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyK()
{
    currentNum="K";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyL()
{
    currentNum="L";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyM()
{
    currentNum="M";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyN()
{
    currentNum="N";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyO()
{
    currentNum="O";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyP()
{
    currentNum="P";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyQ()
{
    currentNum="Q";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyR()
{
    currentNum="R";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyS()
{
    currentNum="S";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyT()
{
    currentNum="T";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyU()
{
    currentNum="U";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyV()
{
    currentNum="V";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyW()
{
    currentNum="W";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyX()
{
    currentNum="X";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyY()
{
    currentNum="Y";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyZ()
{
    currentNum="Z";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyCap()
{
    //TODO
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyShift()
{
    //TODO
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keynum1()
{
    currentNum="1";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keynum2()
{
    currentNum="2";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keynum3()
{
    currentNum="3";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keydot()
{
    currentNum=".";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keycomma()
{
    currentNum=",";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::key_()
{
    currentNum="_";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keySpace()
{
    currentNum=" ";
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::keyBackspace()
{
    //TODO
    showNumber();
}

void GV_ZonesConfigurationDetailInputDialog::showNumber()
{
    //TODO
    if(1){
        totalNum = totalNum + currentNum;
        lineEdit->setText(totalNum);
    }
}
void GV_ZonesConfigurationDetailInputDialog::home()
{
    QDialog *dialog1 = new GV_ZonesConfigurationDetailDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}

void GV_ZonesConfigurationDetailInputDialog::save()
{
    //TODO
}

void GV_ZonesConfigurationDetailInputDialog::cancel()
{
    QDialog *dialog1 = new GV_ZonesConfigurationDetailDialog;
    dialog1->show();
    delete dialog;
    dialog = dialog1;
}



